#!/usr/bin/python
# -*-coding: UTF-8 -*-
"""
# Time: 2025/4/21 11:18
# @Project_name: PROJECT_NAME
"""
import threading

# 定义一个继承自 threading.Thread 的类
class MyThread(threading.Thread):
    def __init__(self, name):
        # 调用父类的构造函数
        threading.Thread.__init__(self)
        self.name = name

    # 重写 run 方法，线程启动后会自动执行该方法
    def run(self):
        print(f"线程 {self.name} 正在运行")

# 创建线程实例
thread1 = MyThread("Thread 1")
thread2 = MyThread("Thread 2")

# 启动线程
thread1.start()
thread2.start()

# 等待线程执行完毕
thread1.join()
thread2.join()

print("所有线程执行完毕")
